#include<iostream>
#include<ctime>
#include"ThreadPoll.hpp"

using namespace std;

int main()
{
    srand(time(nullptr)^getpid());

    //1.制造线程池
    ThreadPoll<int>::GetInstance();
    
    //使用懒汉模式来加载数据
    ThreadPoll<int>::GetInstance()->Run();
    // int data = 888;
    // tp->push(data);

    while(true)
    {
        //2.持续发任务给线程池
        
        int data = rand()%10;
        usleep(10);
        ThreadPoll<int>::GetInstance()->push(data);

        cout << "data is sending..." << endl;
        sleep(1);
    }

    return 0;
}